make DOORs run in Background instead of actually opening-up the application

I have written a dxl script to export modules in excel format. I am executing this script using a .bat file.

@echo off

if "%~1"=="" (
echo This script needs to be started with a DOORS Module

goto :real_end

)

"C:\Program Files\IBM\Rational\DOORS\9.3\bin\doors.exe" -u USERNAME -password PASSWORD -f "%TEMP%" -D "current = read(\"%~1\", true); #include <export_batch.dxl>"

:real_end

But this is opening the GUI which i don't want as i have to export multiple number of modules one by one. I want to run the script as a background process.

I have replaced -D with -b ; but it did not work. Kindly suggest.

Thanks,
SystemAdmin - Fri Feb 15 01:19:02 EST 2013

Re: make DOORs run in Background instead of actually opening-up the application
SystemAdmin - Fri Feb 15 03:56:06 EST 2013

Hi

You can use the "-batch"-Option

"C:\somewhere\doors.exe" -W -batch "C:\somewhereElse\Something.dxl" -user "MySpecialUser" -password "TopSecret"

In this case you cannot use some functions which realy use specific GUI-Gimmicks. For example the doors-tool exchange does not run.

Best regards
Wolfgang

Re: make DOORs run in Background instead of actually opening-up the application
SystemAdmin - Fri Feb 15 08:48:33 EST 2013

SystemAdmin - Fri Feb 15 03:56:06 EST 2013
Hi

You can use the "-batch"-Option

"C:\somewhere\doors.exe" -W -batch "C:\somewhereElse\Something.dxl" -user "MySpecialUser" -password "TopSecret"

In this case you cannot use some functions which realy use specific GUI-Gimmicks. For example the doors-tool exchange does not run.

Best regards
Wolfgang

Hi,

Thanks for your reply. I have already tried with this option. But this is throwing an error message.

My script exports the modules and saves them at specified location in excel format. For this i have modified the inbuilt excel.dxl file a little bit. But each time it opens DOORS and then the intended modules and then it exports it. I don't want this thing to happen. So i need some way so that it can do all these things without really opening the GUI. As i am very new to dxl, i am not able to sort this out in spite of much trials. Here is my script.
 

bool confirm (string s) { print "Confirmed: " s "\n"; return true }
 
void ack (string s) {print "Acknowledge: " s "\n" }
 
void acknowledge (string s) {print "Acknowledge: " s "\n"  }
 
void infoBox (string s) {print "Info: " s "\n" }
 
void info (string s) {print "Info: " s "\n" }
 
 
 
DB theDiag = null
 
 
// Now override block and show, to only do realize
 
void show  (DB x) { realize x; theDiag = x }
 
void block (DB x) { realize x; theDiag = x }
 
 
 
if (null current Module) {
 
print "A current module is needed for export."
 
halt
 
}
 
 
// we need braces, since -D will be executed at top level and we will get name
 
// clashes for variable defined in excel.dxl and the other includes of it.
 
{
 
 
// now include the excel.dxl -> this will pop up the dialog, but not halt execution
 
// due to the overrides above
 
Module mod = current Module
load(view "Standard view")
 
 
#include <standard/export/office/excel_modified.dxl>
 
set(mainChoice, 4)
 
doExcel theDiag
 
saveFileAsModuleName
 
//closeExcel
 
// get rid of the dialog
 
if (!null theDiag) destroy theDiag
}
 
 
// close DOORS
 
exit_

 


As mentioned above i have modified the excel.dxl file to include few functions. I have added saveFileAsModuleName() to save the exported excel file in the specified location with its respective module name.

 

 

 

bool saveFileAsModuleName() {
   if(fileOpen) {
      string filename=name(current Module)
      string baseFileString = "C:\\DOORS_Auto\\" filename ".xls"
 
      // delete the old file
      deleteFile(baseFileString);
 
      clear(args);
      put(args, "FileName", baseFileString);
 
      excelVersion = getRegistry(excelVersionKey, null);
 
      if (excelVersion == "Excel.Application.12") {        // If Excel version is 2007
        put(args, "FileFormat", "56" );     // Save file as Excel 97-2003 .xls format
      }
      
      if(!checkResult(oleMethod(objWorkbook, "SaveAs", args))) {
         errorBox("File SaveAs failed.");
         return(false);
      }
      
      return(true);
   }
   
   errorBox("File not open");
   return(false);
}



Is there any way that i can execute my script in background without any error and it still gives me intended result. Please help.

Thanks,



 

 

Re: make DOORs run in Background instead of actually opening-up the application
llandale - Fri Feb 15 14:07:04 EST 2013

SystemAdmin - Fri Feb 15 08:48:33 EST 2013

Hi,

Thanks for your reply. I have already tried with this option. But this is throwing an error message.

My script exports the modules and saves them at specified location in excel format. For this i have modified the inbuilt excel.dxl file a little bit. But each time it opens DOORS and then the intended modules and then it exports it. I don't want this thing to happen. So i need some way so that it can do all these things without really opening the GUI. As i am very new to dxl, i am not able to sort this out in spite of much trials. Here is my script.
 

bool confirm (string s) { print "Confirmed: " s "\n"; return true }
 
void ack (string s) {print "Acknowledge: " s "\n" }
 
void acknowledge (string s) {print "Acknowledge: " s "\n"  }
 
void infoBox (string s) {print "Info: " s "\n" }
 
void info (string s) {print "Info: " s "\n" }
 
 
 
DB theDiag = null
 
 
// Now override block and show, to only do realize
 
void show  (DB x) { realize x; theDiag = x }
 
void block (DB x) { realize x; theDiag = x }
 
 
 
if (null current Module) {
 
print "A current module is needed for export."
 
halt
 
}
 
 
// we need braces, since -D will be executed at top level and we will get name
 
// clashes for variable defined in excel.dxl and the other includes of it.
 
{
 
 
// now include the excel.dxl -> this will pop up the dialog, but not halt execution
 
// due to the overrides above
 
Module mod = current Module
load(view "Standard view")
 
 
#include <standard/export/office/excel_modified.dxl>
 
set(mainChoice, 4)
 
doExcel theDiag
 
saveFileAsModuleName
 
//closeExcel
 
// get rid of the dialog
 
if (!null theDiag) destroy theDiag
}
 
 
// close DOORS
 
exit_

 


As mentioned above i have modified the excel.dxl file to include few functions. I have added saveFileAsModuleName() to save the exported excel file in the specified location with its respective module name.

 

 

 

bool saveFileAsModuleName() {
   if(fileOpen) {
      string filename=name(current Module)
      string baseFileString = "C:\\DOORS_Auto\\" filename ".xls"
 
      // delete the old file
      deleteFile(baseFileString);
 
      clear(args);
      put(args, "FileName", baseFileString);
 
      excelVersion = getRegistry(excelVersionKey, null);
 
      if (excelVersion == "Excel.Application.12") {        // If Excel version is 2007
        put(args, "FileFormat", "56" );     // Save file as Excel 97-2003 .xls format
      }
      
      if(!checkResult(oleMethod(objWorkbook, "SaveAs", args))) {
         errorBox("File SaveAs failed.");
         return(false);
      }
      
      return(true);
   }
   
   errorBox("File not open");
   return(false);
}



Is there any way that i can execute my script in background without any error and it still gives me intended result. Please help.

Thanks,



 

 

There is no GUI loaded in batch mode, so you cannot use dialog boxes. Your batch code will have to know what to do exactly; no doubt coding which module you want to export, opening it, exporting, closeing and exiting.

Be sure to open the module invisibly:

  • Module mod = read(Name, false)

better yet, load the standard view:

  • Module mod = read(Name, false, true)


If you want a single DXL to run both on-demand and also in batch, you can do something like this:

 

db = create("Export")
set DBEs
apply(db, "Export", applyDoTheWork)
 
if (batchMode()) //
then  applyDoTheWork(db)  // the primary callback
else  {realize(db); show(db)}



-Louie



 

Re: make DOORs run in Background instead of actually opening-up the application
SystemAdmin - Mon Feb 18 01:53:07 EST 2013

llandale - Fri Feb 15 14:07:04 EST 2013

There is no GUI loaded in batch mode, so you cannot use dialog boxes. Your batch code will have to know what to do exactly; no doubt coding which module you want to export, opening it, exporting, closeing and exiting.

Be sure to open the module invisibly:

  • Module mod = read(Name, false)

better yet, load the standard view:

  • Module mod = read(Name, false, true)


If you want a single DXL to run both on-demand and also in batch, you can do something like this:

 

db = create("Export")
set DBEs
apply(db, "Export", applyDoTheWork)
 
if (batchMode()) //
then  applyDoTheWork(db)  // the primary callback
else  {realize(db); show(db)}



-Louie



 

Hi

Doors has the perm isBatch() to detect this state.

Best regards
Wolfgang